/*
 * Copyright (c)e 2024-2024.Powered by 清明雨揽月
 * This software is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

//
// Created by Nefilibata on 2024/8/26.
//

#ifndef SORT_H
#define SORT_H

#define ARRAY_LENGTH 10


class Sort
{
public:
    // 希尔排序
    static void shellSort(int arr[], int n);
    // 直接排序
    static void insertSort(int arr[], int n);
    // 折半插入排序
    static void insertSortPlus(int arr[], int n);
    // 冒泡排序
    static void bubbleSort(int arr[], int n);
    // 快速排序
    static void quickSort(int arr[], int low, int high);
    // 快速排序中划分操作的应用
    static int partition(int arr[], int low, int high);
    // 简单选择排序
    static void selectSort(int arr[], int n);
    // 堆排序
    static void heapSort(int arr[], int len);
    // 建立大根堆算法
    static void buildMaxHeap(int arr[], int len);
    // 对以元素k为根的子树进行调整
    static void headAdjust(int arr[], int k, int len);
    // 将两个有序表合并成一个有序表
    static void merge(int arr[], int low, int mid, int high);
    // 二路归并排序
    static void mergeSort(int arr[], int low, int high);
    // 计数排序
    static void countSort(int arr_a[], int arr_b[], int n, int k);
};


#endif //SORT_H
